import { getTopDetail } from '@/api/topList'
import { getObj } from '@/assets/js/sessionStore'
import { processSongs } from '@/api/song'

async function useRankDetailApi(songListRef) {
  const { id, period } = getObj('RANK_DETAIL')
  const res = await getTopDetail({ id, period })
  const songsWithUrl = await processSongs(res.result.songs)
  songListRef.value = songsWithUrl
}

export default useRankDetailApi
